<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-bind</title>
    <style>
        .active{
                border: 3px solid red;
        }
    </style>
</head>
<body>
    <div id="app">                                       <!-- {active:isActive}表示是否为class赋值active取决于isActive -->
        <img v-bind:src="imgArr" :title="imgTitle+'!'" :class="{active:isActive}" @click="toggleActive"     alt="" style="width: 400px ;">
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app=new Vue({
            el:"#app",
            data:{
                imgArr:"./img/壁纸8.jpg" ,
                imgTitle:"这是壁纸",
                isActive:false,
            },
            methods:{
                toggleActive:function(){
                    this.isActive=!this.isActive
                }
            }
        })
    </script>
</body>
</html>